<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>蛇形文字</title>
	<style type="text/css">
        .spanstyle {
            position:absolute;
            top:-50px;
            font-size:12pt;
            color: red;
            font-weight:bold;
        }
    </style>
</head>
<body>
	
</body>

	<script>
		var str = "你咋不上天，你咋不和太阳肩并肩";		
		for(var i=0;i<str.length;i++){
			document.write("<span id='span"+i+"' class='spanstyle'>");
			document.write(str[i]);
			document.write("</span>");
		}

		document.onmousemove=function(e){
			var test=0;
			var mytime = setInterval(function(){
				if(test>=str.length-1){
					clearInterval(mytime);
				}
				demo(e.clientX,e.clientY,test);
			test++;
			},50);
		}

		function demo(x,y,i){
			var span = document.getElementById("span"+i);
			span.style.left = x+20+(i*20)+"px";
			span.style.top = y+"px";
		}


	</script>

</html>